home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#43 (Apr 89)
/
XCMDSource Code
/
ADSPTalk.p
< prev
Wrap
Text File
|
1989-02-07
|
2KB
|
110 lines
(****************************)
(* file: ADSPTalk.p *)
(* *)
(* Send information to an *)
(* established connection. *)
(* The connection must be *)
(* been established via the *)
(* ADSPCALL xcmd. *)
(* *)
(* In: *)
(* params[1] = entity name *)
(* of the remote end. *)
(* *)
(* ------------------------ *)
(* By: Donald Koscheka *)
(* Date: 2-Mar-89 *)
(* All Rights Reserved *)
(* *)
(* ------------------------ *)
(****************************)
(*****************************
Build Sequence
pascal -o ADSPTalk.p.o ADSPTalk.p
link -m ENTRYPOINT -rt XCMD=1305 -sn Main=ADSPTalk∂
ADSPTalk.p.o∂
"{libraries}"Interface.o ∂
-o YourStackNameHere
*****************************)
{$R-}
{$S ADSPTalk}
UNIT DummyUnit;
(****************************)
INTERFACE
(****************************)
Uses MemTypes, QuickDraw, OSIntf,
ToolIntf, PackIntf, HyperXCmd,
AppleTalk, ADSP, adspxcmd;
Procedure EntryPoint( paramPtr : XCmdPtr );
(****************************)
IMPLEMENTATION
(****************************)
TYPE Str31 = String[31];
PROCEDURE ADSPTalk( paramPtr: XCmdPtr ); FORWARD;
Procedure EntryPoint( paramPtr : XCmdPtr );
Begin
ADSPTalk( paramPtr );
End;
Procedure ADSPTalk( paramPtr : XCmdPtr );
VAR
adsp : ADSPPtr;
error : OSErr;
eAddr : AddrBlock;
cb : cbPtr;
{$I XCmdGlue.inc }
{$I XCMDADSP.inc }
BEGIN
error := noErr;
adsp := ADSPPtr(RetrieveData( 'GLOBALDSPDATA' ));
IF (adsp <> NIL)
AND (paramPtr^.params[1] <> NIL)
AND (paramPtr^.params[2] <> NIL) THEN
BEGIN
adsp^.checkPoint := RECEIVING;
{*** (1) Get the entity's address ***}
HLock( paramPtr^.params[1] );
eAddr := NBPGetAddress( paramPtr^.params[1]^ );
cb := adsp^.ends;
{*** (2) Find entity in connection list***}
IF LongInt( eAddr ) <> 0 THEN
WHILE cb <> NIL DO
IF (LongInt(cb^.adr)=LongInt(eAddr))
AND (cb^.ccb.state=sOpen) THEN
BEGIN
error := DSPTalk(cb, paramPtr^.params[2] );
cb := NIL;
END
ELSE
cb := cb^.next;
adsp^.checkPoint := CLOSE_OK;
HUnlock( Handle(paramPtr^.params[1]) );
END;
paramPtr^.returnValue := PasToZero( NumToStr( LongInt(error) ) );
END;
end.